package com.app.Activity;

import com.app.Controller.ActivityController;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.TextView;
import app.com.ModuleRole.R;

public class frmResultBieuQuyetActivity extends Activity{
	static int index;
	static int valueAgree;
	static int valueDisAgree;
	static int count;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_result_bieu_quyet);
		Log.d("PEERDROID","Da vao frmResultBieuQuyetActivity");
		index = ActivityController.get_index();
		valueAgree = ActivityController.get_valueAgree();
		valueDisAgree = ActivityController.get_valueDisAgree();
		count = ActivityController.get_count();
		Log.d("PEERDROID","Da nhan duoc index: "+ String.valueOf( ActivityController.get_index()));
		Log.d("PEERDROID","Da nhan duoc valueagree: "+ String.valueOf( ActivityController.get_valueAgree()));
		Log.d("PEERDROID","Da nhan duoc valuedisagree: "+ String.valueOf( ActivityController.get_valueDisAgree()));
		Log.d("PEERDROID","Da nhan duoc count: "+ String.valueOf( ActivityController.get_count()));
		
		String vagre = String.valueOf( ActivityController.get_valueAgree());
		String cou = String.valueOf( ActivityController.get_count());
		String vadis = String.valueOf( ActivityController.get_valueDisAgree());
		
		TextView txtxembieuquyet = (TextView)findViewById(R.id.txtViewBieuQuyet);
		TextView txtxembieuquyet1 = (TextView)findViewById(R.id.txtViewBieuQuyet1);
		TextView txtxembieuquyet2 = (TextView)findViewById(R.id.txtViewBieuQuyet2);

		if(index == 1){
			if(valueAgree == count){
				txtxembieuquyet.setText("Ket qua Bieu quyet:"+ vagre +"/"+ cou );
				txtxembieuquyet1.setText("co: "+ vagre +" nguoi dong y"+ "&" + vadis +" nguoi khong dong y");
				txtxembieuquyet2.setText("Bieu quyet duoc thong qua:");
			}else{
				txtxembieuquyet.setText("Ket qua Bieu quyet: "+vagre +"/"+ cou);
				txtxembieuquyet1.setText("co: "+ vagre +" nguoi dong y"+ "&" + vadis +" nguoi khong dong y");
				txtxembieuquyet2.setText("Bieu quyet khong duoc thong qua:");
			}
		}
		else if(index == 2){
			if(valueAgree >= ((count*7)/10)){
				txtxembieuquyet.setText("Ket qua Bieu quyet:"+ vagre +"/"+ cou );
				txtxembieuquyet1.setText("co: "+ vagre +" nguoi dong y"+ "&" + vadis +" nguoi khong dong y");
				txtxembieuquyet2.setText("Bieu quyet duoc thong qua:");
			}else{
				txtxembieuquyet.setText("Ket qua Bieu quyet: "+vagre +"/"+ cou);
				txtxembieuquyet1.setText("co: "+ vagre +" nguoi dong y"+ "&" + vadis +" nguoi khong dong y");
				txtxembieuquyet2.setText("Bieu quyet khong duoc thong qua:");
			}
		}
		else if(index == 3){
			if(valueAgree >= (count/2)){
				txtxembieuquyet.setText("Ket qua Bieu quyet:"+ vagre +"/"+ cou );
				txtxembieuquyet1.setText("co: "+ vagre +" nguoi dong y"+ "&" + vadis +" nguoi khong dong y");
				txtxembieuquyet2.setText("Bieu quyet duoc thong qua:");
			}else{
				txtxembieuquyet.setText("Ket qua Bieu quyet: "+vagre +"/"+ cou);
				txtxembieuquyet1.setText("co: "+ vagre +" nguoi dong y"+ "&" + vadis +" nguoi khong dong y");
				txtxembieuquyet2.setText("Bieu quyet khong duoc thong qua:");
			}
		}
	}
}
